﻿<UserControl x:Class="StockholmsStad.Windows.UI.Modules.Maintenance.Controls.ParvisUserListControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Converters="clr-namespace:StockholmsStad.Windows.UI.Infrastructure.Converters;assembly=StockholmsStad.Windows.UI.Infrastructure">

    <UserControl.Resources>
        <Converters:BoolToStringConverter x:Key="boolToStringConverter" />
    </UserControl.Resources>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
        </Grid.RowDefinitions>

        <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">


            <ListView x:Name="listViewParvisUsers" ItemsSource="{Binding}" Height="150" VerticalAlignment="Top"
                          SelectionChanged="listViewParvisUsers_SelectionChanged" SelectedIndex="0" 
                          ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                          ScrollViewer.VerticalScrollBarVisibility="Auto">
                <ListView.Resources>
                    <Style TargetType="{x:Type TextBlock}">
                        <Setter Property="VerticalAlignment" Value="Center" />
                    </Style>
                </ListView.Resources>
                <ListView.View>

                    <GridView ColumnHeaderContainerStyle="{DynamicResource GridViewColumnHeaderStyle1}" AllowsColumnReorder="False">
                        <GridView.Columns>
                            <GridViewColumn Header="Förnamn" DisplayMemberBinding="{Binding FirstName}" />
                            <GridViewColumn Header="Efternamn" DisplayMemberBinding="{Binding LastName}" />
                            <GridViewColumn Header="Användarnamn" DisplayMemberBinding="{Binding EmailAddress}" />
                            <GridViewColumn Header="Telefon" DisplayMemberBinding="{Binding PhoneNumber}" />
                            <GridViewColumn Header="Mobil" DisplayMemberBinding="{Binding CellPhoneNumber}" />
                            <GridViewColumn Header="Behörighet" DisplayMemberBinding="{Binding UserRole.Description}" />
                            <GridViewColumn Header="Aktiv">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding IsActive, Converter={StaticResource boolToStringConverter}, ConverterParameter='True'}" />
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
            </ListView>

        </ScrollViewer>

    </Grid>
</UserControl>
